How to Install and Use PIP Command on Linux

您所在的位置:网站首页 linux pip install mysql How to Install and Use PIP Command on Linux

How to Install and Use PIP Command on Linux

2023-04-02 12:23| 来源: 网络整理| 查看: 265

Pip is a package management system for managing packages written in Python. It is also known as “Pip Installs Packages” or “Pip Installs Python.” Pip uses Python Package Index (PyPI) for the packages and installs them on your system.

In this post, we will show you how to install and use the Pip command in Linux.

Prerequisites A fresh Debian, Ubuntu, or CentOS server on the Atlantic.Net Cloud Platform A root password configured on your server Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Debian, Ubuntu, or CentOS as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in, run the following command to update your base system with the latest available packages.

apt-get update -y

Or

dnf update -y Install PIP On Debian/Ubuntu

By default, Pip is not installed in the Ubuntu and Debian-based operating systems. You will need to install it using the command line.

To install Pip for Python 2, run the following command:

apt-get install python-pip -y

To install Pip for Python 3, run the following command:

apt-get install python3-pip -y

After the installation, verify the version of Pip using the following command:

pip -V

Or

pip3 -V

You should get the following output:

pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8) Install Pip On CentOS, Fedora and RHEL

By default, Pip is not included in the software repositories of CentOS/RHEL/Fedora, so you will need to install the EPEL repository to your system.

Run the following command to install the EPEL repository.

yum install epel-release -y yum install python3-pip

To check the installed version, run the following command:

pip3 -V

You should get the following output:

pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6) How to Use Pip

To list all Pip commands, run the following command :

pip --help

Sample output:

Usage: pip [options] Commands: install Install packages. download Download packages. uninstall Uninstall packages. freeze Output installed packages in requirements format. list List installed packages. show Show information about installed packages. check Verify installed packages have compatible dependencies. config Manage local and global configuration. search Search PyPI for packages. wheel Build wheels from your requirements. hash Compute hashes of package archives. completion A helper command used for command completion. debug Show information useful for debugging. help Show help for commands.

To install a package with Pip, run:

pip install packagename

To remove a package, run:

pip uninstall packagename

To download a Python package without installing it in your system, run:

pip download packagename

To list all packages, run the following command:

pip list

You should see all installed packages in the following output:

Package Version ---------------------- ---------- certifi 2019.11.28 chardet 3.0.4 click 8.0.1 dbus-python 1.2.16 distro 1.4.0 Flask 2.0.1 idna 2.8 itsdangerous 2.0.1 Jinja2 3.0.1 MarkupSafe 2.0.1 netifaces 0.10.4 numpy 1.21.1 pip 20.0.2 PyGObject 3.36.0 pymacaroons 0.13.0 PyNaCl 1.3.0 PyYAML 5.3.1 requests 2.22.0 setuptools 45.2.0 six 1.14.0 ssh-import-id 5.10 ubuntu-advantage-tools 20.3 urllib3 1.25.8 Werkzeug 2.0.1 wheel 0.34.2

To upgrade a specific package, run the following command:

pip install --upgrade packagename

To display detailed information of any package, run the following command:

pip show flask

You should get the following output:

Name: Flask Version: 2.0.1 Summary: A simple framework for building complex web applications. Home-page: https://palletsprojects.com/p/flask Author: Armin Ronacher Author-email: [email protected] License: BSD-3-Clause Location: /usr/local/lib/python3.8/dist-packages Requires: Jinja2, Werkzeug, itsdangerous, click Required-by: Conclusion

In the above guide, we explained how to install and Pip on Linux. Pip is a very useful utility that simplifies the process of Python package installation. Give it a try on your dedicated server from Atlantic.Net!

 

Learn more about dedicated hosting.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3